package org.csu.mybigpro.controller;

import org.csu.mybigpro.common.CommonResponse;
import org.csu.mybigpro.domain.Classroom;
import org.csu.mybigpro.persistence.ClassroomMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/classrooms")
public class ClassroomController {

    @Autowired
    private ClassroomMapper classroomMapper;

    @GetMapping
    public CommonResponse<List<Classroom>> getAllClassrooms() {
        List<Classroom> classrooms = classroomMapper.selectList(null);
        return CommonResponse.createForSuccess(classrooms);
    }
}